\(\int \cos ^n(c+d x) \sin ^2(a+b x) \, dx\) [219]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (warning: unable to verify)
   Maple [F]
   Fricas [F]
   Sympy [F(-1)]
   Maxima [F]
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 17, antiderivative size = 386 \[ \int \cos ^n(c+d x) \sin ^2(a+b x) \, dx=-\frac {i 2^{-2-n} e^{-i (2 a+c n)-i (2 b+d n) x+i n (c+d x)} \left (1+e^{2 i c+2 i d x}\right )^{-n} \left (e^{-i (c+d x)}+e^{i (c+d x)}\right )^n \operatorname {Hypergeometric2F1}\left (\frac {1}{2} \left (-\frac {2 b}{d}-n\right ),-n,\frac {1}{2} \left (2-\frac {2 b}{d}-n\right ),-e^{2 i (c+d x)}\right )}{2 b+d n}+\frac {i 2^{-2-n} e^{i (2 a-c n)+i (2 b-d n) x+i n (c+d x)} \left (1+e^{2 i c+2 i d x}\right )^{-n} \left (e^{-i (c+d x)}+e^{i (c+d x)}\right )^n \operatorname {Hypergeometric2F1}\left (\frac {1}{2} \left (\frac {2 b}{d}-n\right ),-n,\frac {1}{2} \left (2+\frac {2 b}{d}-n\right ),-e^{2 i (c+d x)}\right )}{2 b-d n}+\frac {i 2^{-1-n} \left (e^{-i (c+d x)}+e^{i (c+d x)}\right )^n \left (1+e^{2 i (c+d x)}\right )^{-n} \operatorname {Hypergeometric2F1}\left (-n,-\frac {n}{2},1-\frac {n}{2},-e^{2 i (c+d x)}\right )}{d n} \]

[Out]

-I*2^(-2-n)*exp(-I*(c*n+2*a)-I*(d*n+2*b)*x+I*n*(d*x+c))*(exp(-I*(d*x+c))+exp(I*(d*x+c)))^n*hypergeom([-n, -b/d
-1/2*n],[1-b/d-1/2*n],-exp(2*I*(d*x+c)))/((1+exp(2*I*c+2*I*d*x))^n)/(d*n+2*b)+I*2^(-2-n)*exp(I*(-c*n+2*a)+I*(-
d*n+2*b)*x+I*n*(d*x+c))*(exp(-I*(d*x+c))+exp(I*(d*x+c)))^n*hypergeom([-n, b/d-1/2*n],[1+b/d-1/2*n],-exp(2*I*(d
*x+c)))/((1+exp(2*I*c+2*I*d*x))^n)/(-d*n+2*b)+I*2^(-1-n)*(exp(-I*(d*x+c))+exp(I*(d*x+c)))^n*hypergeom([-n, -1/
2*n],[1-1/2*n],-exp(2*I*(d*x+c)))/d/((1+exp(2*I*(d*x+c)))^n)/n

Rubi [A] (verified)

Time = 0.77 (sec) , antiderivative size = 386, normalized size of antiderivative = 1.00, number of steps used = 11, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.412, Rules used = {4651, 2320, 2057, 371, 2323, 2285, 2283} \[ \int \cos ^n(c+d x) \sin ^2(a+b x) \, dx=-\frac {i 2^{-n-2} \left (e^{-i (c+d x)}+e^{i (c+d x)}\right )^n \left (1+e^{2 i c+2 i d x}\right )^{-n} \operatorname {Hypergeometric2F1}\left (\frac {1}{2} \left (-\frac {2 b}{d}-n\right ),-n,\frac {1}{2} \left (-\frac {2 b}{d}-n+2\right ),-e^{2 i (c+d x)}\right ) \exp (-i (2 a+c n)-i x (2 b+d n)+i n (c+d x))}{2 b+d n}+\frac {i 2^{-n-2} \left (e^{-i (c+d x)}+e^{i (c+d x)}\right )^n \left (1+e^{2 i c+2 i d x}\right )^{-n} \operatorname {Hypergeometric2F1}\left (\frac {1}{2} \left (\frac {2 b}{d}-n\right ),-n,\frac {1}{2} \left (\frac {2 b}{d}-n+2\right ),-e^{2 i (c+d x)}\right ) \exp (i (2 a-c n)+i x (2 b-d n)+i n (c+d x))}{2 b-d n}+\frac {i 2^{-n-1} \left (e^{-i (c+d x)}+e^{i (c+d x)}\right )^n \left (1+e^{2 i (c+d x)}\right )^{-n} \operatorname {Hypergeometric2F1}\left (-n,-\frac {n}{2},1-\frac {n}{2},-e^{2 i (c+d x)}\right )}{d n} \]

[In]

Int[Cos[c + d*x]^n*Sin[a + b*x]^2,x]

[Out]

((-I)*2^(-2 - n)*E^((-I)*(2*a + c*n) - I*(2*b + d*n)*x + I*n*(c + d*x))*(E^((-I)*(c + d*x)) + E^(I*(c + d*x)))
^n*Hypergeometric2F1[((-2*b)/d - n)/2, -n, (2 - (2*b)/d - n)/2, -E^((2*I)*(c + d*x))])/((1 + E^((2*I)*c + (2*I
)*d*x))^n*(2*b + d*n)) + (I*2^(-2 - n)*E^(I*(2*a - c*n) + I*(2*b - d*n)*x + I*n*(c + d*x))*(E^((-I)*(c + d*x))
 + E^(I*(c + d*x)))^n*Hypergeometric2F1[((2*b)/d - n)/2, -n, (2 + (2*b)/d - n)/2, -E^((2*I)*(c + d*x))])/((1 +
 E^((2*I)*c + (2*I)*d*x))^n*(2*b - d*n)) + (I*2^(-1 - n)*(E^((-I)*(c + d*x)) + E^(I*(c + d*x)))^n*Hypergeometr
ic2F1[-n, -1/2*n, 1 - n/2, -E^((2*I)*(c + d*x))])/(d*(1 + E^((2*I)*(c + d*x)))^n*n)

Rule 371

Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[a^p*((c*x)^(m + 1)/(c*(m + 1)))*Hyperg
eometric2F1[-p, (m + 1)/n, (m + 1)/n + 1, (-b)*(x^n/a)], x] /; FreeQ[{a, b, c, m, n, p}, x] &&  !IGtQ[p, 0] &&
 (ILtQ[p, 0] || GtQ[a, 0])

Rule 2057

Int[((c_.)*(x_))^(m_.)*((a_.)*(x_)^(j_.) + (b_.)*(x_)^(n_.))^(p_), x_Symbol] :> Dist[c^IntPart[m]*(c*x)^FracPa
rt[m]*((a*x^j + b*x^n)^FracPart[p]/(x^(FracPart[m] + j*FracPart[p])*(a + b*x^(n - j))^FracPart[p])), Int[x^(m
+ j*p)*(a + b*x^(n - j))^p, x], x] /; FreeQ[{a, b, c, j, m, n, p}, x] &&  !IntegerQ[p] && NeQ[n, j] && PosQ[n
- j]

Rule 2283

Int[((a_) + (b_.)*(F_)^((e_.)*((c_.) + (d_.)*(x_))))^(p_)*(G_)^((h_.)*((f_.) + (g_.)*(x_))), x_Symbol] :> Simp
[a^p*(G^(h*(f + g*x))/(g*h*Log[G]))*Hypergeometric2F1[-p, g*h*(Log[G]/(d*e*Log[F])), g*h*(Log[G]/(d*e*Log[F]))
 + 1, Simplify[(-b/a)*F^(e*(c + d*x))]], x] /; FreeQ[{F, G, a, b, c, d, e, f, g, h, p}, x] && (ILtQ[p, 0] || G
tQ[a, 0])

Rule 2285

Int[((a_) + (b_.)*(F_)^((e_.)*(v_)))^(p_)*(G_)^((h_.)*(u_)), x_Symbol] :> Int[G^(h*ExpandToSum[u, x])*(a + b*F
^(e*ExpandToSum[v, x]))^p, x] /; FreeQ[{F, G, a, b, e, h, p}, x] && LinearQ[{u, v}, x] &&  !LinearMatchQ[{u, v
}, x]

Rule 2320

Int[u_, x_Symbol] :> With[{v = FunctionOfExponential[u, x]}, Dist[v/D[v, x], Subst[Int[FunctionOfExponentialFu
nction[u, x]/x, x], x, v], x]] /; FunctionOfExponentialQ[u, x] &&  !MatchQ[u, (w_)*((a_.)*(v_)^(n_))^(m_) /; F
reeQ[{a, m, n}, x] && IntegerQ[m*n]] &&  !MatchQ[u, E^((c_.)*((a_.) + (b_.)*x))*(F_)[v_] /; FreeQ[{a, b, c}, x
] && InverseFunctionQ[F[x]]]

Rule 2323

Int[(u_.)*((a_.)*(F_)^(v_) + (b_.)*(F_)^(w_))^(n_), x_Symbol] :> Dist[(a*F^v + b*F^w)^n/(F^(n*v)*(a + b*F^Expa
ndToSum[w - v, x])^n), Int[u*F^(n*v)*(a + b*F^ExpandToSum[w - v, x])^n, x], x] /; FreeQ[{F, a, b, n}, x] &&  !
IntegerQ[n] && LinearQ[{v, w}, x]

Rule 4651

Int[Cos[(c_.) + (d_.)*(x_)]^(q_.)*Sin[(a_.) + (b_.)*(x_)]^(p_.), x_Symbol] :> Dist[1/2^(p + q), Int[ExpandInte
grand[(E^((-I)*(c + d*x)) + E^(I*(c + d*x)))^q, (I/E^(I*(a + b*x)) - I*E^(I*(a + b*x)))^p, x], x], x] /; FreeQ
[{a, b, c, d, q}, x] && IGtQ[p, 0] &&  !IntegerQ[q]

Rubi steps \begin{align*} \text {integral}& = 2^{-2-n} \int \left (2 \left (e^{-i (c+d x)}+e^{i (c+d x)}\right )^n-e^{-2 i a-2 i b x} \left (e^{-i (c+d x)}+e^{i (c+d x)}\right )^n-e^{2 i a+2 i b x} \left (e^{-i (c+d x)}+e^{i (c+d x)}\right )^n\right ) \, dx \\ & = -\left (2^{-2-n} \int e^{-2 i a-2 i b x} \left (e^{-i (c+d x)}+e^{i (c+d x)}\right )^n \, dx\right )-2^{-2-n} \int e^{2 i a+2 i b x} \left (e^{-i (c+d x)}+e^{i (c+d x)}\right )^n \, dx+2^{-1-n} \int \left (e^{-i (c+d x)}+e^{i (c+d x)}\right )^n \, dx \\ & = -\frac {\left (i 2^{-1-n}\right ) \text {Subst}\left (\int \frac {\left (\frac {1}{x}+x\right )^n}{x} \, dx,x,e^{i (c+d x)}\right )}{d}-\left (2^{-2-n} e^{i n (c+d x)} \left (1+e^{2 i c+2 i d x}\right )^{-n} \left (e^{-i (c+d x)}+e^{i (c+d x)}\right )^n\right ) \int e^{-2 i a-2 i b x-i n (c+d x)} \left (1+e^{2 i c+2 i d x}\right )^n \, dx-\left (2^{-2-n} e^{i n (c+d x)} \left (1+e^{2 i c+2 i d x}\right )^{-n} \left (e^{-i (c+d x)}+e^{i (c+d x)}\right )^n\right ) \int e^{2 i a+2 i b x-i n (c+d x)} \left (1+e^{2 i c+2 i d x}\right )^n \, dx \\ & = -\left (\left (2^{-2-n} e^{i n (c+d x)} \left (1+e^{2 i c+2 i d x}\right )^{-n} \left (e^{-i (c+d x)}+e^{i (c+d x)}\right )^n\right ) \int e^{i (2 a-c n)+i (2 b-d n) x} \left (1+e^{2 i c+2 i d x}\right )^n \, dx\right )-\left (2^{-2-n} e^{i n (c+d x)} \left (1+e^{2 i c+2 i d x}\right )^{-n} \left (e^{-i (c+d x)}+e^{i (c+d x)}\right )^n\right ) \int e^{-i (2 a+c n)-i (2 b+d n) x} \left (1+e^{2 i c+2 i d x}\right )^n \, dx-\frac {\left (i 2^{-1-n} \left (e^{i (c+d x)}\right )^n \left (e^{-i (c+d x)}+e^{i (c+d x)}\right )^n \left (1+e^{2 i (c+d x)}\right )^{-n}\right ) \text {Subst}\left (\int x^{-1-n} \left (1+x^2\right )^n \, dx,x,e^{i (c+d x)}\right )}{d} \\ & = -\frac {i 2^{-2-n} \exp (-i (2 a+c n)-i (2 b+d n) x+i n (c+d x)) \left (1+e^{2 i c+2 i d x}\right )^{-n} \left (e^{-i (c+d x)}+e^{i (c+d x)}\right )^n \operatorname {Hypergeometric2F1}\left (\frac {1}{2} \left (-\frac {2 b}{d}-n\right ),-n,\frac {1}{2} \left (2-\frac {2 b}{d}-n\right ),-e^{2 i (c+d x)}\right )}{2 b+d n}+\frac {i 2^{-2-n} \exp (i (2 a-c n)+i (2 b-d n) x+i n (c+d x)) \left (1+e^{2 i c+2 i d x}\right )^{-n} \left (e^{-i (c+d x)}+e^{i (c+d x)}\right )^n \operatorname {Hypergeometric2F1}\left (\frac {1}{2} \left (\frac {2 b}{d}-n\right ),-n,\frac {1}{2} \left (2+\frac {2 b}{d}-n\right ),-e^{2 i (c+d x)}\right )}{2 b-d n}+\frac {i 2^{-1-n} \left (e^{-i (c+d x)}+e^{i (c+d x)}\right )^n \left (1+e^{2 i (c+d x)}\right )^{-n} \operatorname {Hypergeometric2F1}\left (-n,-\frac {n}{2},1-\frac {n}{2},-e^{2 i (c+d x)}\right )}{d n} \\ \end{align*}

Mathematica [A] (warning: unable to verify)

Time = 1.46 (sec) , antiderivative size = 242, normalized size of antiderivative = 0.63 \[ \int \cos ^n(c+d x) \sin ^2(a+b x) \, dx=-\frac {i 2^{-2-n} e^{-2 i (a+b x)+i (c+d x)} \left (e^{-i (c+d x)} \left (1+e^{2 i (c+d x)}\right )\right )^{1+n} \left (d n (-2 b+d n) \operatorname {Hypergeometric2F1}\left (1,1-\frac {b}{d}+\frac {n}{2},1-\frac {b}{d}-\frac {n}{2},-e^{2 i (c+d x)}\right )+e^{2 i (a+b x)} (2 b+d n) \left (d e^{2 i (a+b x)} n \operatorname {Hypergeometric2F1}\left (1,1+\frac {b}{d}+\frac {n}{2},1+\frac {b}{d}-\frac {n}{2},-e^{2 i (c+d x)}\right )+2 (2 b-d n) \operatorname {Hypergeometric2F1}\left (1,\frac {2+n}{2},1-\frac {n}{2},-e^{2 i (c+d x)}\right )\right )\right )}{-4 b^2 d n+d^3 n^3} \]

[In]

Integrate[Cos[c + d*x]^n*Sin[a + b*x]^2,x]

[Out]

((-I)*2^(-2 - n)*E^((-2*I)*(a + b*x) + I*(c + d*x))*((1 + E^((2*I)*(c + d*x)))/E^(I*(c + d*x)))^(1 + n)*(d*n*(
-2*b + d*n)*Hypergeometric2F1[1, 1 - b/d + n/2, 1 - b/d - n/2, -E^((2*I)*(c + d*x))] + E^((2*I)*(a + b*x))*(2*
b + d*n)*(d*E^((2*I)*(a + b*x))*n*Hypergeometric2F1[1, 1 + b/d + n/2, 1 + b/d - n/2, -E^((2*I)*(c + d*x))] + 2
*(2*b - d*n)*Hypergeometric2F1[1, (2 + n)/2, 1 - n/2, -E^((2*I)*(c + d*x))])))/(-4*b^2*d*n + d^3*n^3)

Maple [F]

\[\int \cos \left (d x +c \right )^{n} \sin \left (x b +a \right )^{2}d x\]

[In]

int(cos(d*x+c)^n*sin(b*x+a)^2,x)

[Out]

int(cos(d*x+c)^n*sin(b*x+a)^2,x)

Fricas [F]

\[ \int \cos ^n(c+d x) \sin ^2(a+b x) \, dx=\int { \cos \left (d x + c\right )^{n} \sin \left (b x + a\right )^{2} \,d x } \]

[In]

integrate(cos(d*x+c)^n*sin(b*x+a)^2,x, algorithm="fricas")

[Out]

integral(-(cos(b*x + a)^2 - 1)*cos(d*x + c)^n, x)

Sympy [F(-1)]

Timed out. \[ \int \cos ^n(c+d x) \sin ^2(a+b x) \, dx=\text {Timed out} \]

[In]

integrate(cos(d*x+c)**n*sin(b*x+a)**2,x)

[Out]

Timed out

Maxima [F]

\[ \int \cos ^n(c+d x) \sin ^2(a+b x) \, dx=\int { \cos \left (d x + c\right )^{n} \sin \left (b x + a\right )^{2} \,d x } \]

[In]

integrate(cos(d*x+c)^n*sin(b*x+a)^2,x, algorithm="maxima")

[Out]

integrate(cos(d*x + c)^n*sin(b*x + a)^2, x)

Giac [F]

\[ \int \cos ^n(c+d x) \sin ^2(a+b x) \, dx=\int { \cos \left (d x + c\right )^{n} \sin \left (b x + a\right )^{2} \,d x } \]

[In]

integrate(cos(d*x+c)^n*sin(b*x+a)^2,x, algorithm="giac")

[Out]

integrate(cos(d*x + c)^n*sin(b*x + a)^2, x)

Mupad [F(-1)]

Timed out. \[ \int \cos ^n(c+d x) \sin ^2(a+b x) \, dx=\int {\cos \left (c+d\,x\right )}^n\,{\sin \left (a+b\,x\right )}^2 \,d x \]

[In]

int(cos(c + d*x)^n*sin(a + b*x)^2,x)

[Out]

int(cos(c + d*x)^n*sin(a + b*x)^2, x)